package com.nyist.springcloud.controller;

import com.nyist.springcloud.ResultVO;
import com.nyist.springcloud.entities.Payment;
import com.nyist.springcloud.service.FeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yangxiaogen
 * @date 2021/1/31 14:36
 */
@RestController
@RequestMapping("/consumer")
@Slf4j
public class FeignController {

    @Autowired
    private FeignService feignService;

    @PostMapping(value = "/pay/lb")
    public ResultVO<Payment> getPaymentLb(@RequestBody Payment payment) {

        return feignService.getPaymentLbConsumer(payment);
    }

    @PostMapping(value = "/pay/timeout")
    public ResultVO<Payment> getPaymentTimeout(@RequestBody Payment payment) {

        return feignService.getPaymentTimeout(payment);
    }
}